<template>
  <template v-if="inited">
<!--    {{widgetConfig.enums}}-->
<!--{{state}}-->
    <el-rate
        v-model="state.value"
        v-bind="state.OPT.widgetConfig"
        v-on="listeners"
    ></el-rate>
  </template>

</template>

<script>
import {CustomRenderControlMixin, defineCustomRender, PROPS_DEF} from "@/plugins/form-render/utils/index";
import {ref} from "vue";
import {QuickBooleanWithNull} from "@/hooks/props";

export default {
  name: 'CusRate',
  mixins: [
      CustomRenderControlMixin
  ],
  CUS_TITLE: '分数',
  CUS_EDITOR: function () {
    return {
      props: {
        // enums: {
        //   type: 'string',
        //   ui: {
        //     label: '枚举',
        //     notice: '枚举可以使用的方法 [sdsd](sdsds)'
        //   }
        // }
        ['showText']: QuickBooleanWithNull('显示文字'),
        ['allowHalf']: QuickBooleanWithNull('允许半选'),
      }
    }
  },
  setup(props, ctx) {
    let { data, methods, listeners, init } = defineCustomRender(props, ctx, {
      handleValueInit(v) {
        return v
      }
    })
    let state = data({
    })
    init(props)

    return {
      state,
      widgetConfig: props?.ui?.widgetConfig,
      methods,
      listeners,
    }
  },
}
</script>

